//
// Created by lfm on 2025/3/16.
//

#include "Student.h"
#include <iostream>
using namespace std;

// 学生类构造函数，初始化学生ID
Student::Student(string Id)
    : m_Name(""), m_Id(Id), m_Age(0), m_Chinese(0), m_Math(0), m_English(0)
{
}

// 学生类构造函数，初始化学生姓名、ID、年龄以及各科成绩
Student::Student(std::string name, std::string id, int age, int chinese,
                 int math, int english)
    : m_Name(name), m_Id(id), m_Age(age), m_Chinese(chinese), m_Math(math),
      m_English(english)
{
}

// 显示学生信息
void Student::Display()
{
    cout << m_Id << "\t" << m_Name << "\t" << m_Age << "\t" << m_Chinese << "\t"
         << m_Math << "\t" << m_English << endl;
}

// 重载输出流操作符，以方便输出学生信息
std::ostream &operator<<(std::ostream &out, const Student &stu)
{
    out << stu.m_Id << "\t" << stu.m_Name << "\t" << stu.m_Age << "\t"
        << stu.m_Chinese << "\t" << stu.m_Math << "\t" << stu.m_English
        << std::endl;
    return out;
}

// 重载等于操作符，以比较两个学生对象是否具有相同的ID
bool Student::operator==(const Student &right) const
{
    return this->m_Id == right.m_Id;
}